//
//  MTSize.m
//  MiTu
//
//  Created by CY on 15/11/11.
//  Copyright © 2015年 CY. All rights reserved.
//

#import "MTSize.h"
#import "MTFuncDefine.h"

@implementation MTSize

+ (CGFloat)getLengthWithSizeType:(OTSSizeType)sizeType andLength:(CGFloat)length
{
    CGFloat resultLength = length * [[self multiplicative][@([self getCurrentSizeType])] doubleValue] / [[self multiplicative][@(sizeType)] doubleValue];
    resultLength = ceil(resultLength);
    
    return resultLength;
}

+ (OTSSizeType)getCurrentSizeType
{
    static OTSSizeType currentSizeType = OTSSizeTypeNone;
    
    if (currentSizeType == OTSSizeTypeNone) {
        if (ISIPHONE3_5) {
            currentSizeType = OTSSizeType3_5;
        }
        else if (ISIPHONE4_0) {
            currentSizeType = OTSSizeType4_0;
        }
        else if (ISIPHONE4_7) {
            currentSizeType = OTSSizeType4_7;
        }
        else if (ISIPHONE5_5) {
            currentSizeType = OTSSizeType5_5;
        }
    }
    
    return currentSizeType;
}

+ (NSDictionary *)multiplicative
{
    return @{@0:@0,
             @1:@320,
             @2:@320,
             @3:@375,
             @4:@414,
             @5:@768};
}
@end
